﻿using System;
using System.Speech.Synthesis;
using System.Text;

namespace NetFrameworkTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.InputEncoding = Encoding.UTF8;
            var synth = new SpeechSynthesizer();
            Prompt prompt = null;
            while (true)
            {
                var msg = Console.ReadLine();
                if (msg.StartsWith("Exit"))
                    break;
                if (prompt != null && !prompt.IsCompleted)
                    synth.SpeakAsyncCancel(prompt);
                prompt = synth.SpeakAsync(msg);
            }
        }
    }
}
